<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/gesture-util.js"></script>
<style>
  body {
    height: 2000px;
  }
  #plugin {
    position: absolute;
    top: 500px;
    width: 150px;
    height: 150px;
  }
</style>
</head>

<body onload="runTest();">
<embed id="plugin" type="application/x-webkit-test-webplugin" primitive="triangle" background-color="green" primitive-color="blue"></embed>
<script>
jsTestIsAsync = true;
async function runTest() {
    if (!window.testRunner) {
        document.write("This test does not work in manual mode.");
    } else {
        testRunner.dumpAsText();
        internals.updateLayoutAndRunPostLayoutTasks();

        // Scroll so the plugin is 100px down the page
        window.scroll(0, 400);

        // These events should not reach the plugin since it's futher down on the page.
        eventSender.gestureShowPress(30, 30);
        eventSender.gestureShowPress(30, 530);

        // Send some gesture events to the plugin.
        var positionX = 30;
        var positionY = 110;
        await touchTapOn(positionX, positionY);
        await smoothScrollWithXY(30, 0, positionX, positionY, GestureSourceType.TOUCH_INPUT, SPEED_INSTANT);
    }
    finishJSTest();
}
</script>
</body>
</html>
